﻿using CNav.Domain;
using FluentValidation;

namespace CNav.Business.Validation
{
    public class AddressValidation : AbstractValidator<Address>
    {
        public AddressValidation()
        {
            RuleFor(a => a.CountryID).NotNull().WithMessage("Please provide valid country id");
            RuleFor(a => a.State).NotEmpty().Length(2, 20).WithMessage("Please provide valid state name");
            RuleFor(a => a.City).NotEmpty().Length(2, 20).WithMessage("Please provide valid city name");
            RuleFor(a => a.Address1).NotEmpty().Length(1, 50).WithMessage("Please provide address line1 atleast 1 and 50 character long");
            RuleFor(a => a.PostalCode).NotEmpty().Length(2, 10).WithMessage("Please provide valid postcode");
        }
    }
}